package com.jjkj.environmental.environmental.utils

import android.app.Activity
import java.util.*

object ActivityHelper {
    private fun Activity.showToast(msg: String) {
        ToastUtils.showToast(this, msg)
    }

    private val activityList = ArrayList<Activity>()
    fun addActivity(activity: Activity) {
        activityList.add(activity)
    }

    fun removeActivity(activity: Activity) {
        activityList.remove(activity)
    }

    fun clearActivity(activity: Activity) {
        activityList.clear()
    }

    fun getStackTop(): Activity {
        return activityList.last()
    }

    fun showToast(msg: String) {
        activityList.last().showToast(msg)
    }
}